#include <bits/stdc++.h>
// 2025/01/23
// tag: 
// Author: Zhang Muen
using namespace std;

int n, t[100001];
vector<int> nation[100001];

signed main()
{
    cin >> n;
    for (int i = 1, k; i <= n; i++){
        cin >> t[i] >> k;
        for (int j = 1, p; j <= k; j++)
            cin >> p, nation[i].push_back(p);
    }
    int last = 0;
    unordered_map<int, int> us;
    int cnt = 0;
    for (int i = 1; i <= n; i++)
    {
        for (auto x: nation[i]){
            if (us[x] == 0)
                cnt++;
            us[x]++;
        }
        while (t[i] - t[last] >= 86400){
            for (auto x: nation[last]){
                us[x]--;
                if (us[x] == 0)
                    cnt--;
            }
            last++;
        }
        cout << cnt << endl;
    }
    return 0;
}